package com.example.streamsqlpark.enums;

import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;

/**
 * @author voloiono
 * @date 2024/4/19 16:45
 */
public enum StorageType implements Serializable {
    /** hdfs */
    HDFS("hdfs"),

    /** local File system */
    LFS("lfs");

    private final String identifier;

    StorageType(String identifier) {
        this.identifier = identifier;
    }

    public String getIdentifier() {
        return identifier;
    }

    public static StorageType of(String identifier) {
        if (StringUtils.isEmpty(identifier)) {
            return LFS;
        }
        for (StorageType type : values()) {
            if (type.identifier.equals(identifier)) {
                return type;
            }
        }
        return LFS;
    }
}
